<template>
    <f7-page class="common-page has-bottom-btns">
        <f7-navbar>
            <f7-nav-left>
                <f7-link back icon-material="chevron_left" force></f7-link>
            </f7-nav-left>
            <f7-nav-title>整改结果</f7-nav-title>
            <f7-nav-right></f7-nav-right>
        </f7-navbar>
        <van-form input-align="right" ref="form">
            <van-field v-model="models.model.replyContent" required label="处理结果"
                :rules="[{ required: true, message: '请输入处理结果' }]" rows="3" autosize type="textarea" placeholder="请输入">
            </van-field>
            <qm-file-upload ref="mobileReplyPic" :galleryOptions="{ multiple: true, maximum: 9 }" :params="{
                type: 'attach',
                dataKey: taskId,
                bizType: 'mobileReplyPhoto',
            }" uploadId="mobileReplyPic">
            </qm-file-upload>
        </van-form>
        <f7-toolbar position="bottom" no-shadow class="fff">
            <f7-button fill class="submit-btn" @click="onCommit">提交
            </f7-button>
        </f7-toolbar>
    </f7-page>
</template>

<script>
import controller from "@/libs/framework/workflowController";

export default class instance extends controller {
    onBeforeInit() {
        this.urls = {
            model: "/equipment/eqmMobilePatrol/workflow/getWorkflowViewModel"
        };
    }
    onInit() {
        this.context.taskId = this.$f7route.query.taskId;
    }
    onAfterQuery(type, isSuccess, result) {
        return result;
    }

    onAfterSave(isSuccess, result) {
        if (isSuccess) {
            this.$f7.views.current.router.back({ force: true });
        }
    }

    mixin() {
        return {
            data() {
                return {
                    taskId:'',
                    models: {
                        model: {
                            replyContent: "",
                        }
                    },
                    selectUser: {
                        selectComment: null,
                        comment: null,
                        comments: [],
                        tran: [],
                        activity: "",
                        users: [],
                    },
                };
            },
            methods: {
                onCommit() {
                    this.$refs.form
                        .validate()
                        .then((res) => {
                            this.selectUser.comment = this.models.model.replyContent;
                            this.send();
                        })
                        .catch((err) => {
                            console.log(err);
                        });
                },
            },
        };
    }
}
</script>

<style lang="less" scoped>
@import url("../../../../../../assets/css/commonPage.less");
.van-form{
    background: #fff;
    padding-bottom: 30px;
    .list{
        margin: 15px 0;
    }
}
</style>
